#!/usr/bin/env php
<?php
require_once 'common.php';

defined('IN_PHAR') or define('IN_PHAR', boolval(\Phar::running(false)));
defined('RUNNING_ROOT') or define('RUNNING_ROOT', realpath(getcwd()));
defined('APPLICATION_ROOT') or define('APPLICATION_ROOT', IN_PHAR ? \Phar::running() : realpath(getcwd()));

$file = APPLICATION_ROOT . '/vendor/autoload.php';
if (file_exists($file)) {
    require_once $file;
} else {
    die("include composer autoload.php fail\n");
}
$config = require_once 'config.php';
$args = $argv;

\app\storage\Config::getInstance($config);
\app\base\CommandRunner::run($args);

// $server = new \app\module\websocket\Chatee(
//         \app\storage\Config::getConfig('host'),
//         \app\storage\Config::getConfig('port'),
//         \app\storage\Config::getConfig('settings.swoole')
// );
// $server->run();
